#include "PthreadPool.h"



void createWorker(PthreadPool * pp,int size){
    for(int i = 0 ; i < size-1 ; ++i){
        pthread_create(&pp->thd_arry.pid[i],NULL,threadFunc,pp);
    }
    pthread_create(&pp->thd_arry.pid[size-1],NULL,singleFunc,NULL);
}


int pthreadPoolInit(PthreadPool * pp,int size){
    pthreadArryInit(&pp->thd_arry,size);
    readyQueueInit(&pp->rdy_que);
    pthread_mutex_init(&pp->lock1,NULL);
    pthread_cond_init(&pp->cond,NULL);
    createWorker(pp,size);
    return 0;
}
